home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3dm / audio / ALwritesamps.z / ALwritesamps
Encoding:
Text File  |  2002-10-03  |  11.6 KB  |  199 lines

  1.  
  2.  
  3.  
  4. AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm))))                                            AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ALwritesamps - (obsolete) write samples to an audio port
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
  13.  
  14.      iiiinnnntttt AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((AAAALLLLppppoooorrrrtttt ppppoooorrrrtttt,,,, vvvvooooiiiidddd ****ssssaaaammmmpppplllleeeessss,,,, lllloooonnnngggg ssssaaaammmmpppplllleeeeccccoooouuuunnnntttt))))
  15.  
  16. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
  17.      _p_o_r_t          expects the AAAALLLLppppoooorrrrtttt structure for the audio port to which
  18.                    you want to write samples.  This structure is the returned
  19.                    value of the AAAALLLLooooppppeeeennnnppppoooorrrrtttt((((3333ddddmmmm)))) call.
  20.  
  21.      _s_a_m_p_l_e_s       expects a pointer to a buffer from which you want to
  22.                    transfer the sound samples into the audio port.
  23.  
  24.      _s_a_m_p_l_e_c_o_u_n_t   expects the number of samples that you want to write to the
  25.                    port.
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss is obsolete and is provided for backward compatibility. The
  29.      preferred function is aaaallllWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss((((3333ddddmmmm)))), which uses units of sample
  30.      frames.
  31.  
  32.      AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) writes samples to the audio port buffer. If there is
  33.      not sufficient buffer space in the audio port, AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) will
  34.      block until enough space becomes available for the transfer to complete.
  35.      Normally, AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) will return before the sound has finished
  36.      playing.
  37.  
  38.      To delay until the sound has finished playing, keep calling
  39.      AAAALLLLggggeeeettttffffiiiilllllllleeeedddd((((3333ddddmmmm)))) and ssssggggiiiinnnnaaaapppp((((2222)))) until AAAALLLLggggeeeettttffffiiiilllllllleeeedddd((((3333ddddmmmm)))) returns 0, or set
  40.      the fillpoint to the queuesize minus one and call sssseeeelllleeeecccctttt((((2222)))) or ppppoooollllllll((((2222)))).
  41.  
  42.      By calling AAAALLLLggggeeeettttffffiiiillllllllaaaabbbblllleeee((((3333ddddmmmm)))) you can determine how many samples will fit
  43.      into the internal buffer without blocking.
  44.  
  45.      The _s_a_m_p_l_e_s buffer is interpreted differently depending on the current
  46.      configuration of the port.  In particular, the _w_i_d_t_h setting specified by
  47.      AAAALLLLsssseeeettttwwwwiiiiddddtttthhhh((((3333ddddmmmm)))) determines which of the bits in the buffer make up the
  48.      sound samples.  Samples of width AAAALLLL____SSSSAAAAMMMMPPPPLLLLEEEE____8888 ((((cccchhhhaaaarrrr)))) and AAAALLLL____SSSSAAAAMMMMPPPPLLLLEEEE____11116666
  49.      ((((sssshhhhoooorrrrtttt)))) are treated as normal signed numbers which contain the most
  50.      significant 8 or 16 bits of the audio amplitude measurement,
  51.      respectively.  Samples of width AAAALLLL____SSSSAAAAMMMMPPPPLLLLEEEE____22224444 ((((lllloooonnnngggg)))) are treated as signed
  52.      24 bit numbers packed into the low 24 bits sign extended to fill a long.
  53.      They may be treated as longs in the range -8388608 to 8388607.  Only the
  54.      least significant 24 bits of the long are used by the audio hardware.
  55.  
  56.      In the case that the port is configured to use floating point or double
  57.      precision floating point samples (see AAAALLLLsssseeeettttssssaaaammmmppppffffmmmmtttt((((3333ddddmmmm))))), the _w_i_d_t_h
  58.      setting is ignored, and the samples are treated as floating point or
  59.      double precision floating point, respectively.
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm))))                                            AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.      When you send samples to a stereo audio port, AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) sends the
  75.      odd numbered samples to the right channel and sends the even numbered
  76.      samples to the left channel. This notion of odd and even includes all the
  77.      samples that have ever been sent to this port, so channel swapping
  78.      confusion can be avoided by always sending an even number of samples to a
  79.      stereo audio port (i.e. _s_a_m_p_l_e_c_o_u_n_t is an integer multiple of the frame
  80.      size, in this case 2).
  81.  
  82.      In the case of a 4-channel port, you should write only an integer number
  83.      of frames of data (viz., samplecount should be a multiple of 4) to a
  84.      port. If a non-integer number of frames is written to a port,
  85.      AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) will not transfer the samples and will return an error.
  86.  
  87.      Though 4-channel audio ports can be opened successfully for all IRIS
  88.      workstations with high-quality audio, not all hardware can support 4
  89.      line-level electrical connections (e.g. Indigo). In the case that the
  90.      hardware is unable to support these connections, AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) will
  91.      mix the two pairs of samples to a stereo signal.
  92.  
  93.      Consider the following situation: 4 samples (L1, R1, L2, R2) are written
  94.      to a 4-channel port on a machine without the 4-channel capability. In
  95.      this case, the 4 samples will be summed to 2 samples in the following
  96.      manner:  (L1, R1, L2, R2) becomes (L1+L2, R1+R2). These sums are then
  97.      limited to avoid overflow and sent to the audio hardware as a stereo
  98.      pair. Thus, no information is lost when using a 4-channel port on a
  99.      machine without the 4-channel capability.
  100.  
  101.      In the case that the hardware is capable of 4 line-level output signals
  102.      AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) will send the samples (L1, R1, L2, R2) to the output
  103.      connections in the following manner: sample pair (L1, R1) will be sent to
  104.      the regular line-level output; and sample pair (L2, R2) will be sent to
  105.      the headphone output (which is electrically configured to line-level by
  106.      AAAALLLLsssseeeettttppppaaaarrrraaaammmmssss((((3333ddddmmmm)))) using the AL_CHANNEL_MODE/AL_4CHANNEL parameter/value
  107.      pair).
  108.  
  109.      You can determine whether a system has the 4-channel capability with
  110.      AAAALLLLggggeeeettttmmmmiiiinnnnmmmmaaaaxxxx((((3333ddddmmmm)))). Once you have determined that a system does possess
  111.      this capability, you can configure the system for 4-channels with
  112.      AAAALLLLsssseeeettttppppaaaarrrraaaammmmssss((((3333ddddmmmm)))). Note that hardware with the 4-channel capability must
  113.      be configured to have the proper 4-channel line-level connections. By
  114.      default, all hardware will behave as a stereo device.
  115.  
  116.      If you want to change the sample format, the maximum value for floating
  117.      point/double precision data, or sample size settings, you can call
  118.      AAAALLLLsssseeeettttssssaaaammmmppppffffmmmmtttt((((3333ddddmmmm)))), AAAALLLLsssseeeettttffffllllooooaaaattttmmmmaaaaxxxx((((3333ddddmmmm)))), and AAAALLLLsssseeeettttwwwwiiiiddddtttthhhh((((3333ddddmmmm)))) followed by a
  119.      call to AAAALLLLsssseeeettttccccoooonnnnffffiiiigggg((((3333ddddmmmm)))).
  120.  
  121.      AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) can fail for the following reason:
  122.  
  123.      AAAALLLL____BBBBAAAADDDD____TTTTRRRRAAAANNNNSSSSFFFFEEEERRRR____SSSSIIIIZZZZEEEE   _s_a_m_p_l_e_c_o_u_n_t is not a multiple of the frame size
  124.                             set by AAAALLLLsssseeeettttcccchhhhaaaannnnnnnneeeellllssss((((3333ddddmmmm)))). This error pertains to
  125.                             4-channel ports only.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm))))                                            AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm))))
  137.  
  138.  
  139.  
  140.      In order to achieve the best possible performance, AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) does
  141.      not verify that _p_o_r_t or _s_a_m_p_l_e_s are valid. You should make certain these
  142.      values are valid before passing them as arguments to AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))).
  143.  
  144. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  145.      Upon successful completion, AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) returns 0. Otherwise
  146.      AAAALLLLwwwwrrrriiiitttteeeessssaaaammmmppppssss((((3333ddddmmmm)))) returns -1 and sets an error number which can be
  147.      retrieved with oooosssseeeerrrrrrrroooorrrr((((3333CCCC)))).
  148.  
  149. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  150.      ALopenport(3dm), ALgetfillable(3dm), ALgetfilled(3dm),
  151.      ALsetchannels(3dm), ALsetwidth(3dm), ALgetchannels(3dm), ALgetwidth(3dm),
  152.      ALsetfillpoint(3dm), ALsetsampfmt(3dm), ALsetfloatmax(3dm),
  153.      ALgetminmax(3dm), sginap(2), oserror(3C)
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.